﻿using System.Windows;
using PSE.Deployment.Engine.Enums;

namespace PSE.Deployment.SetupBase.UI
{
    /// <summary>
    /// Interaction logic for Messagem.xaml
    /// </summary>
    public partial class ErrorNotification : BaseWindow
    {
        public StepErrorAction ErrorAction
        {
            get;
            internal set;
        }

        public string ErrorMessage
        {
            set { txtError.Text = value; }
        }

        public ErrorNotification()
            : this(false)
        {

        }

        public ErrorNotification(bool showIgnoreButton)
        {
            this.InitializeComponent();

            if (showIgnoreButton)
                BtnIgnore.Visibility = Visibility.Visible;
            else
                BtnIgnore.Visibility = Visibility.Collapsed;
        }

        private void BtnIgnore_Click(object sender, RoutedEventArgs e)
        {
            this.ErrorAction = StepErrorAction.Ignore;
            this.Close();
        }

        private void BtnRetry_Click(object sender, RoutedEventArgs e)
        {
            this.ErrorAction = StepErrorAction.TryAgain;
            this.Close();
        }

        private void BtnCancel_Click(object sender, RoutedEventArgs e)
        {
            this.ErrorAction = StepErrorAction.CancelParent;
            this.Close();
        }
    }

}